package com.cy.personer.biz.impl;

import com.cy.personer.bean.Combo;
import com.cy.personer.bean.Suggest;
import com.cy.personer.bean.Summary;
import com.cy.personer.biz.SuggestBiz;
import com.cy.personer.ceptor.OperationLog;
import com.cy.personer.mapper.SuggestMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

//建议
@Service
public class SuggestBizImpl implements SuggestBiz {

    @Resource
    SuggestMapper suggestMapper;
    /**
     * 新增建议
     * @param suggest
     * @return
     * @author 林少艺
     */
    @OperationLog(operType="添加",methods = "填写报告建议" )
    @Override
    public boolean addSuggest(Suggest suggest) {
        return suggestMapper.addSuggest(suggest)>0;
    }

    /**
     * 修改建议
     * @param suggest
     * @return
     * @author 林少艺
     */
    @OperationLog(operType="修改",methods = "修改报告建议" )
    @Override
    public boolean updateSuggest(Suggest suggest) {
        return suggestMapper.updateSuggest(suggest)>0;
    }

    /**
     * 查找建议列表
     * @param suggest
     * @return
     * @author 林少艺
     */
    @Override
    public PageInfo<Suggest> getSuggests(Suggest suggest,int pageNum) {
        Page<Suggest> page = PageHelper.startPage(pageNum,5);
        suggestMapper.getSuggests(suggest);
        PageInfo<Suggest> pageInfo = new PageInfo<>(page);
        return pageInfo;
    }

    /**
     * 查找建议列表
     * @param suggest
     * @return
     * @author 林少艺
     */
    @Override
    public Suggest getSuggest(Suggest suggest) {
        return suggestMapper.getSuggest(suggest);
    }

    /**
     * 删除建议
     * @param suggest
     * @return
     * @author 林少艺
     */
    @OperationLog(operType="删除",methods = "删除报告建议" )
    @Override
    public boolean delSuggest(Suggest suggest) {
        return suggestMapper.delSuggest(suggest)>0;
    }
}
